var net = new Object();
net.ajaxRequest = function(url,onload,onerror,method,params){
	this.req = null;
	this.onload = onload;
	this.onerror = (onerror)? onerror:this.defaultError;
	this.loadDate(url,method,params);
}
net.ajaxRequest.prototype.loadDate = function(url,method,params){
	if(!method){
		method="GET"
	}
	if(window.XMLHttpRequest){
		this.req = new XMLHttpRequest;	//创建XMLHTTPRequest的对象
	}else if(window.ActiveXObject()){
		this.req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(this.req){
		try{
			var loader = this;
			this.req.onreadystatechange = function(){
				net.ajaxRequest.onreadystatechange().call(loader);
			}
			this.req.open(method,url,true);
		if(method=="POST"){
			this.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		}
			this.req.send(params);		
		}catch(err){
			this.onerror.call(this);
		}
	}
}
	net.ajaxRequest.onreadystatechange = function(){
		var req = this.req;
		var ready = req.readyState;
		if(ready==4){
			if(req.status==200){
				this.onload.call(this);
			}else{
				this.onerror.call(this);
			}
		}
	}
	net.ajaxRequest.prototype.defaultError = function(){
		alert("错误数据\n\n回调状态"+this.req.readyState+"\n状态"+this.req.status
		);
		
	}
